3.8.79 \(\int \cos ^2(c+d x) (a+b \sec (c+d x))^2 (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [779]

3.8.79.1 Optimal result
3.8.79.2 Mathematica [A] (verified)
3.8.79.3 Rubi [A] (verified)
3.8.79.4 Maple [A] (verified)
3.8.79.5 Fricas [A] (verification not implemented)
3.8.79.6 Sympy [F]
3.8.79.7 Maxima [A] (verification not implemented)
3.8.79.8 Giac [B] (verification not implemented)
3.8.79.9 Mupad [B] (verification not implemented)

3.8.79.1 Optimal result

Integrand size = 40, antiderivative size = 60 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=a (2 b B+a C) x+\frac {b (b B+2 a C) \text {arctanh}(\sin (c+d x))}{d}+\frac {a^2 B \sin (c+d x)}{d}+\frac {b^2 C \tan (c+d x)}{d} \]

output
a*(2*B*b+C*a)*x+b*(B*b+2*C*a)*arctanh(sin(d*x+c))/d+a^2*B*sin(d*x+c)/d+b^2 
*C*tan(d*x+c)/d
 
3.8.79.2 Mathematica [A] (verified)

Time = 1.81 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.82 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {a (2 b B+a C) (c+d x)-b (b B+2 a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+b (b B+2 a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+a^2 B \sin (c+d x)+b^2 C \tan (c+d x)}{d} \]

input
Integrate[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c 
+ d*x]^2),x]
 
output
(a*(2*b*B + a*C)*(c + d*x) - b*(b*B + 2*a*C)*Log[Cos[(c + d*x)/2] - Sin[(c 
 + d*x)/2]] + b*(b*B + 2*a*C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + a 
^2*B*Sin[c + d*x] + b^2*C*Tan[c + d*x])/d
 
3.8.79.3 Rubi [A] (verified)

Time = 0.42 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3042, 4560, 3042, 4512, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (B \csc \left (c+d x+\frac {\pi }{2}\right )+C \csc \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 4560

\(\displaystyle \int \cos (c+d x) (a+b \sec (c+d x))^2 (B+C \sec (c+d x))dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\left (a+b \csc \left (c+d x+\frac {\pi }{2}\right )\right )^2 \left (B+C \csc \left (c+d x+\frac {\pi }{2}\right )\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 4512

\(\displaystyle \frac {a^2 B \sin (c+d x)}{d}-\int \left (-b^2 C \sec ^2(c+d x)-b (b B+2 a C) \sec (c+d x)-a (2 b B+a C)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^2 B \sin (c+d x)}{d}+\frac {b (2 a C+b B) \text {arctanh}(\sin (c+d x))}{d}+a x (a C+2 b B)+\frac {b^2 C \tan (c+d x)}{d}\)

input
Int[Cos[c + d*x]^2*(a + b*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c + d*x] 
^2),x]
 
output
a*(2*b*B + a*C)*x + (b*(b*B + 2*a*C)*ArcTanh[Sin[c + d*x]])/d + (a^2*B*Sin 
[c + d*x])/d + (b^2*C*Tan[c + d*x])/d
 

3.8.79.3.1 Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4512
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^2*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[a^2*A*Cos[ 
e + f*x]*((d*Csc[e + f*x])^(n + 1)/(d*f*n)), x] + Simp[1/(d*n)   Int[(d*Csc 
[e + f*x])^(n + 1)*(a*(2*A*b + a*B)*n + (2*a*b*B*n + A*(b^2*n + a^2*(n + 1) 
))*Csc[e + f*x] + b^2*B*n*Csc[e + f*x]^2), x], x] /; FreeQ[{a, b, d, e, f, 
A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LeQ[n, -1]
 

rule 4560
Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_. 
)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.) 
*(x_)]*(d_.))^(n_.), x_Symbol] :> Simp[1/b^2   Int[(a + b*Csc[e + f*x])^(m 
+ 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ 
[{a, b, c, d, e, f, A, B, C, m, n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]
 
3.8.79.4 Maple [A] (verified)

Time = 0.45 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.43

method result size
derivativedivides \(\frac {B \,a^{2} \sin \left (d x +c \right )+C \,a^{2} \left (d x +c \right )+2 B a b \left (d x +c \right )+2 C a b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \,b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C \,b^{2} \tan \left (d x +c \right )}{d}\) \(86\)
default \(\frac {B \,a^{2} \sin \left (d x +c \right )+C \,a^{2} \left (d x +c \right )+2 B a b \left (d x +c \right )+2 C a b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+B \,b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C \,b^{2} \tan \left (d x +c \right )}{d}\) \(86\)
parallelrisch \(\frac {-2 b \cos \left (d x +c \right ) \left (B b +2 C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+2 b \cos \left (d x +c \right ) \left (B b +2 C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+B \,a^{2} \sin \left (2 d x +2 c \right )+4 a x d \left (B b +\frac {C a}{2}\right ) \cos \left (d x +c \right )+2 C \sin \left (d x +c \right ) b^{2}}{2 d \cos \left (d x +c \right )}\) \(118\)
risch \(2 B a b x +a^{2} x C -\frac {i B \,a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i B \,a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {2 i C \,b^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,b^{2}}{d}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,b^{2}}{d}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}\) \(160\)
norman \(\frac {\left (-2 B a b -C \,a^{2}\right ) x +\left (-4 B a b -2 C \,a^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\left (-2 B a b -C \,a^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (2 B a b +C \,a^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (2 B a b +C \,a^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (4 B a b +2 C \,a^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {2 \left (B \,a^{2}-C \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {2 \left (B \,a^{2}+C \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {4 B \,a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {4 B \,a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {4 C \,b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{3}}+\frac {b \left (B b +2 C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \left (B b +2 C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(335\)

input
int(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method 
=_RETURNVERBOSE)
 
output
1/d*(B*a^2*sin(d*x+c)+C*a^2*(d*x+c)+2*B*a*b*(d*x+c)+2*C*a*b*ln(sec(d*x+c)+ 
tan(d*x+c))+B*b^2*ln(sec(d*x+c)+tan(d*x+c))+C*b^2*tan(d*x+c))
 
3.8.79.5 Fricas [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.95 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (C a^{2} + 2 \, B a b\right )} d x \cos \left (d x + c\right ) + {\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, C a b + B b^{2}\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B a^{2} \cos \left (d x + c\right ) + C b^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, 
 algorithm="fricas")
 
output
1/2*(2*(C*a^2 + 2*B*a*b)*d*x*cos(d*x + c) + (2*C*a*b + B*b^2)*cos(d*x + c) 
*log(sin(d*x + c) + 1) - (2*C*a*b + B*b^2)*cos(d*x + c)*log(-sin(d*x + c) 
+ 1) + 2*(B*a^2*cos(d*x + c) + C*b^2)*sin(d*x + c))/(d*cos(d*x + c))
 
3.8.79.6 Sympy [F]

\[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \left (B + C \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]

input
integrate(cos(d*x+c)**2*(a+b*sec(d*x+c))**2*(B*sec(d*x+c)+C*sec(d*x+c)**2) 
,x)
 
output
Integral((B + C*sec(c + d*x))*(a + b*sec(c + d*x))**2*cos(c + d*x)**2*sec( 
c + d*x), x)
 
3.8.79.7 Maxima [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.72 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (d x + c\right )} C a^{2} + 4 \, {\left (d x + c\right )} B a b + 2 \, C a b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + B b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, B a^{2} \sin \left (d x + c\right ) + 2 \, C b^{2} \tan \left (d x + c\right )}{2 \, d} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, 
 algorithm="maxima")
 
output
1/2*(2*(d*x + c)*C*a^2 + 4*(d*x + c)*B*a*b + 2*C*a*b*(log(sin(d*x + c) + 1 
) - log(sin(d*x + c) - 1)) + B*b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + 
c) - 1)) + 2*B*a^2*sin(d*x + c) + 2*C*b^2*tan(d*x + c))/d
 
3.8.79.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 154 vs. \(2 (60) = 120\).

Time = 0.34 (sec) , antiderivative size = 154, normalized size of antiderivative = 2.57 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (C a^{2} + 2 \, B a b\right )} {\left (d x + c\right )} + {\left (2 \, C a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (2 \, C a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1}}{d} \]

input
integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, 
 algorithm="giac")
 
output
((C*a^2 + 2*B*a*b)*(d*x + c) + (2*C*a*b + B*b^2)*log(abs(tan(1/2*d*x + 1/2 
*c) + 1)) - (2*C*a*b + B*b^2)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + 2*(B*a^ 
2*tan(1/2*d*x + 1/2*c)^3 - C*b^2*tan(1/2*d*x + 1/2*c)^3 - B*a^2*tan(1/2*d* 
x + 1/2*c) - C*b^2*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^4 - 1))/d
 
3.8.79.9 Mupad [B] (verification not implemented)

Time = 17.30 (sec) , antiderivative size = 163, normalized size of antiderivative = 2.72 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {C\,b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {2\,C\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {B\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{2\,d\,\cos \left (c+d\,x\right )}+\frac {4\,B\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {4\,C\,a\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \]

input
int(cos(c + d*x)^2*(B/cos(c + d*x) + C/cos(c + d*x)^2)*(a + b/cos(c + d*x) 
)^2,x)
 
output
(C*b^2*tan(c + d*x))/d + (2*C*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/ 
2)))/d + (2*B*b^2*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (B*a^2 
*sin(2*c + 2*d*x))/(2*d*cos(c + d*x)) + (4*B*a*b*atan(sin(c/2 + (d*x)/2)/c 
os(c/2 + (d*x)/2)))/d + (4*C*a*b*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/ 
2)))/d